﻿using Cobra11Undercover.Material;
using Engine.Graphics;
using Scenario_Editor.AddinManager;
using Scenario_Editor.Tools;
using SharpDX;
using System;
using System.Windows.Forms;

namespace Cobra11Undercover.Terrain
{
    public partial class TerrainPaintingControl : UserControl, ITerrainPaintingControl
    {
        #region Private Fields

        private MaterialManager MaterialManager;

        #endregion Private Fields

        #region Public Constructors

        public TerrainPaintingControl()
        {
            InitializeComponent();
        }

        #endregion Public Constructors

        #region Public Properties

        public bool PaintMaterial { get; set; }

        public bool PaintVertexData { get; set; }

        public float TextureBrushSize { get; set; }

        public IGameVertex VertexData
        {
            get
            {
                return new C11UCVertex.C11UCData()
                {
                    DiffuseColor = new Color4()
                    {
                        Alpha = 1.0f,
                        Red = 0.40f,
                        Green = 0.40f,
                        Blue = 0.40f
                    },
                    VertexColor = new Color4()
                    {
                        Alpha = 1.0f,
                        Red = 1.0f,
                        Green = 0.0f,
                        Blue = 1.0f
                    },
                    UV = Vector3.Zero,
                    UV2 = Vector4.Zero
                };
            }

            set
            {
                MessageBox.Show("Set VertexData!");
            }
        }

        #endregion Public Properties

        #region Public Methods

        public Engine.Graphics.Material GetCurrentTerrainMaterial()
        {
            return new Engine.Graphics.Material(new C11Material(10, 10, 10, EnumMappingMode.material00, this.MaterialManager));
        }

        public void MaterialManagerChanged(object sender, EventArgs e)
        {
            this.MaterialManager = (Engine.Graphics.MaterialManager)sender;
        }

        public void OnMaterialChange(object material, EventArgs e)
        {
            throw new NotImplementedException();
        }

        public void UseTool(Vector3 PositionIn3dRoom, Engine.Engine engine, float viewDistance, RoadV2 roadbuilderV2, ObjectPlacerControl objectPlacer)
        {
            throw new NotImplementedException();
        }

        #endregion Public Methods
    }
}